/**
 * 推荐出去的页面
 * author:zhangjlt
 * date:2017年4月20日13:30:42
 */
;
define(function(require, exports, module) {
	var wechat = require("wechat");
	var activecard = {
		/**
		 * bindEvent 页面事件
		 */
		bindEvent: function() {
			//返回
			$("#return_credit").unbind().on("click", function() {
				window.location.href = "#home";
			});
		},
		/**
		 * 进行页面路由监听配置 
		 */
		bindRout: function() {
			//公共页面监听路由
			Path.map("#home").to(function() {
				//返回首页
				common.loadPage({
					pageUrl: "html/index.html",
					reload: false,
					from: "left"
				});
			});
			Path.listen();
		},
		/**
		 * 页面数据加载
		 */
		init: function() {
			activecard.gatWechatInfo();
		},
		getShareDetail: function() {

			var param = {
				"openId": window.localStorage.getItem("openId"),
				"appId": window.localStorage.getItem("appId")
			};
			common.loadData({
				url: "/wxmember/service/getShareDetail",
				param: param,
				successCallBack:function(res){
					
				}, //回调函数
				dataSource: "getShareDetail",
				cache: false //标识是不加载全部
			});
		},
		gatWechatInfo: function() {
			var openId = common.getURLparams().openid;
			var appId = common.getURLparams().appid;
			var param = {};
			common.loadData({
				url: "/webchat/getuserinfo?appid=" + appId + "&openid=" + openId, //"/UMPPubServlet?method=getWxUserInfo",
				param: param,
				successCallBack: function(res) {
					if(res.status == "1") {
						var headImgUrl = res.data.headImgUrl;
						window.localStorage.setItem("headImgUrl", headImgUrl);
						$("#headImg_shared").attr("src", headImgUrl);
						$("#name_shared").text(res.data.nickname);
					}
				}, //回调函数
				cache: false

			});

		},
		/**
		 * each page init mothed
		 */
		initialize: function() {

			if(common.isWeiXin()) {
				$(".jh1_main").css("margin-top", "0rem");
			}
			//动态加载数据
			this.init();
			//事件绑定
			this.bindEvent();
			//路由绑定
			this.bindRout();
		}
	};

	module.exports = activecard;
});